<%--
  Created by IntelliJ IDEA.
  User: LWLONG
  Date: 2021/2/26
  Time: 9:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<%--    type 1 表示修改 否则默认添加--%>
    <title>
   <c:if test="${type == 1}">修改商品</c:if>
        <c:if test="${type != 1}">添加商品</c:if>
    </title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- 在web项目中 css的路径要替换为 css文件的uri
    也就是 /项目名/css/style.css
    -->
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css" />
</head>

<body>
<div id="wrap">
    <div id="top_content">
        <div id="header">
            <div id="rightheader">
            </div>
            <div id="topheader">
                <h1 id="title">
                    <a href="${pageContext.request.contextPath}/product/queryList">商品管理</a>
                </h1>
            </div>
            <div id="navigation">
            </div>
        </div>
        <div id="content">
            <p id="whereami">
            </p>

            <h4 style="color: #CE090E">${msg}</h4>
            <c:remove scope="session" var="msg"></c:remove>
            <h1>
                <title>  <c:if test="${type == 1}">修改商品</c:if>
                    <c:if test="${type != 1}">添加商品 <c:remove var="product" scope="session"></c:remove> </c:if>
                </title>
            </h1>


              <form action="${pageContext.request.contextPath}/product/<c:choose><c:when test="${type==1}">update</c:when><c:otherwise>addProduct</c:otherwise></c:choose>" method="post">

                <table cellpadding="0" cellspacing="0" border="0" class="form_table">

                   <c:if test="${type==1}"><input hidden type="text" name="id" value="${product.id}"> </c:if>

                    <tr>
                        <td valign="middle" align="right">
                            商品名:
                        </td>
                        <td valign="middle" align="left">
                            <input type="text" class="inputgri" name="name" value="${product.name}" />
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" align="right">
                            价格:
                        </td>
                        <td valign="middle" align="left">
                            <input type="text" class="inputgri" name="price" value="${product.price}" />(￥)
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" align="right">
                            库存:
                        </td>
                        <td valign="middle" align="left">
                            <input type="text" class="inputgri" name="account" value="${product.account}" />(个)
                        </td>
                    </tr>
                   <div  type="hidden"><tr>
                        <td valign="middle" align="right">
                            状态:
                        </td>
                        <td valign="middle" align="left">
                            <input type="text" class="inputgri" name="status" value="0" />(0上架 1下架)
                        </td>
                    </tr>
                   </div>
                    <tr>
                        <td valign="middle" align="right">
                            商品描述:
                        </td>
                        <td valign="middle" align="left">
                            <textarea rows="4" cols="30" class="inputgri" name="description"  tabindex="0">${product.description}</textarea>
                        </td>
                    </tr>
                </table>
                <p>
                  <input type="submit" class="button" value="确认" /> &nbsp
                <button > <a href="${pageContext.request.contextPath}/product/queryList">返回</a></button>
                </p>
            </form>
        </div>
    </div>
    <div id="footer">
        <div id="footer_bg">
            www.zparkhr.com.cn
        </div>
    </div>
</div>
</body>

</html>
